#include <iostream>

using namespace std;

typedef long long LL;

const int N = 110, MOD = 1e6 + 7;

LL f[N];
int  n, m, a[N];

int main()
{
	cin >> n >> m;
	for(int i = 1; i <= n; i++) cin >> a[i];
	f[0] = 1;
	for(int i = 1; i <= n; i++)
	{
		for(int j = m; j >= 0; j--)
		{
			for(int k = 1; k <= min(j, a[i]); k++)
			{
				f[j] += f[j - k];
				f[j] %= MOD;
			}
		}
	}
	cout << f[m] << endl;
	return 0;
}
